﻿using STHPMS1.DAL.D_Core;
using System.Data;
using ServiceStack.OrmLite;
using STHPMS1.ICore.I_Entity.Stmpms1;
using STHPMS1.Common.C_Entity.Stmpms1;
using STHPMS1.ICore.I_DAL.Repository;
using System.Collections.Generic;
namespace STHPMS1.DAL.D_Repository
{
    public class Dp_Preven_PlanRepository : DalBase, IDp_Preven_PlanRepository
    {

        /// <summary>
        /// 选取效益费用最优的养护年份
        /// </summary>
        /// <param name="rdwayid"></param>
        /// <param name="mainsegid"></param>
        /// <returns></returns>
        public string GetYear(string anniname, string rdwayid, string mainsegid)
        {
            IDbConnection conn = Adapter.OpenDbConnection();
            string strsql = " select top 1 MAIN_YEAR from [DP_COSTBENEFIT] where ANNI_NAME='" + anniname + "' AND RDWAYID='" + rdwayid + "' and MAINSEGID='" + mainsegid + "' order by BCR desc";
            return conn.Scalar<string>(strsql);
        }
    }
}
